#!/usr/bin/python
# -*- coding: iso-8859-2 -*-
from inc_funs import *
class word:
        #szo class
        def __init__(self, h,s):
                self.hr=h
                self.sr=s
        def __len__(self):
                return len(self.sr)
        def __getitem__(self, i):
                return self.sr[i]
        #hangrend adat
        def h(self):
                return self.hr
        #string adat
        def s(self):
                return self.sr
        #utolso maganhangzo
        def umh(self):
                if self.sr[-1] in maganh:
                        return self.sr[-1]
                else:
                        k=1
                        for c in range(len(self.sr)):
                                if self.sr[-k] in maganh:
                                        return self.sr[-k]
                                else:
                                        k=k+1
                        return 'o'
        #targyas ragozas
        def t(self):
                if self.sr[-1] in maganh:
                        '''if self.sr[-1] in rovidek:
                                self.sr=self.sr[:-1]+hosszuak[rovidek.index(self.sr[-1])]'''
                        return self.sr+'t'
                else:
                        if (self.sr[-1] not in maganh) and (self.sr[-2] not in maganh):
                                if self.hr==0:
                                        return self.sr+self.umh()+'t'
                        elif self.hr==0:
                                if self.umh() in mely:
                                        return self.sr+'ot'
                                elif self.umh() in magas:
                                        return self.sr+'et'
                                else: return self.sr+'t'
                        elif self.hr==1:
                                return self.sr+'et'
                        elif self.hr==2:
                                return self.sr+'ot'
        # valvel
        def v(self):
                if self.sr[-1] in maganh:
                        self.sr = self.sr + 'v'
                elif self.sr[-1] not in maganh:
                        self.sr = self.sr + self.sr[-1]
                if self.hr==0:
                        if self.umh() in mely:
                                return self.sr+'al'
                        elif self.umh() in magas:
                                return self.sr+'el'
                        else: return self.sr+'al'
                        
                elif self.hr==1:
                        return self.sr+'el'
                elif self.hr==2:
                        return self.sr+'al'
        # tobbesszam
        def ss(self):
                if self.sr[-1] in maganh:
                        return self.sr+'k'
                else:
                        if self.hr==0:
                                return self.sr+'ok'
                        elif self.hr==1:
                                return self.sr+'ek'
                        else:
                                return self.sr+'ak'
        # nevelo
        def a(self):
                if self.sr[0] in maganh:
                        return 'az ' + self.sr
                else:
                        return 'a ' + self.sr
        # szomoruan, busan
        def n(self):
                if self.sr[-1] in maganh:
                        return self.sr+'n'
                else:
                        if self.hr==0:
                                return self.sr+'an'
                        elif self.hr==1:
                                return self.sr+'en'
                        elif self.hr==2:
                                return self.sr+'an'
        def szoto(self):
                if self.sr[-2:] == 'ik':
                        return self.sr[:-2]
                elif self.sr[-2:] == 'ni':
                        return self.sr[:-2]
                else:
                        return self.sr
        # szarni, aludni, enni, anyadni
        def ni(self):
                self.sr=self.szoto()
                return self.sr+'ni'
                                
                                
        

class wordlist(list):
    #szolista class
    def __init__(self):
        self.l=1

